cmake_minimum_required(VERSION 2.6)

project(algorithms CXX)
enable_testing()

set(CMAKE_COLOR_MAKEFILE ON)

set(CXX_STANDARD "c++11")

if(MSVC)
  set(GTEST_CMAKE_ARGS "-Dgtest_force_shared_crt=ON")
  if(MSVC11)
    add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
    add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1)
    add_definitions(-D_VARIADIC_MAX=10)
    set(GTEST_CMAKE_ARGS "${GTEST_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=-DGTEST_HAS_TR1_TUPLE=0")
    set(GTEST_CMAKE_ARGS "${GTEST_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1")
    set(GTEST_CMAKE_ARGS "${GTEST_CMAKE_ARGS} -DCMAKE_CXX_FLAGS=-D_VARIADIC_MAX=10")
  endif()
else()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

# google test include
include(ExternalProject)

ExternalProject_Add(gtest
  SVN_REPOSITORY http://googletest.googlecode.com/svn/tags/release-1.7.0/@707
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest
  # Disable update step (because revision is fixed
  UPDATE_COMMAND ""
  # Disable install step
  INSTALL_COMMAND ""
  CMAKE_ARGS ${GTEST_CMAKE_ARGS}
)
ExternalProject_Get_Property(gtest SOURCE_DIR BINARY_DIR)
message("gtest BINARY_DIR: ${BINARY_DIR}")
message("gtest SOURCE_DIR: ${SOURCE_DIR}")
link_directories(${BINARY_DIR})
include_directories(${SOURCE_DIR}/include)


include_directories(${CMAKE_HOME_DIRECTORY}) # add include for root dir

add_subdirectory(library)
add_subdirectory(dynamic_programming)

